package com.thread.join.demo1;

public class Test {

	public static void main(String[] args) {
		Sleeper sleepy = new Sleeper("sleepy", 2000);
		Sleeper grumpy = new Sleeper("grumpy", 2000);

		Joiner dopey = new Joiner("dopey", sleepy);
		Joiner doc = new Joiner("doc", grumpy);

		// join()可以通过interrupt()中断
		// 当另一个线程在该线程上调用interrupt()时，将给该线程设定一个标志，表明该线程已经被中断，然而，异常被捕获时将清理这个标志位，所以在catch中，这个标志总是为false
		grumpy.interrupt();
	}

}
